package com.yunchao.feature.business.data

import androidx.room.Room
import com.yunchao.feature.business.data.datasource.api.BusinessService
import com.yunchao.feature.business.data.datasource.database.BusinessDatabase
import com.yunchao.feature.business.data.repository.BusinessRepositoryImpl
import com.yunchao.feature.business.domain.repository.BusinessRepository
import org.koin.dsl.module
import retrofit2.Retrofit

internal val dataModule = module {

    single { get<Retrofit>().create(BusinessService::class.java) }

    single {
        Room.databaseBuilder(
            get(),
            BusinessDatabase::class.java,
            "Bank-Business.db",
        ).build()
    }

    single { get<BusinessDatabase>().businessInfoDao() }

    single<BusinessRepository> { BusinessRepositoryImpl(get(), get(), get(), get()) }
}